#define _CRT_SECURE_NO_WARNINGS
void reserve(int* left, int* right)
{
    while (left < right)
    {
        int tmp = *left;
        *left = *right;
        *right = tmp;
        left++;
        right--;
    }
}
void rotate(int* nums, int numsSize, int k) {
    reserve(nums, nums + numsSize - 1);
    reserve(nums, nums + k % numsSize - 1);
    reserve(nums + k % numsSize, nums + numsSize - 1);
}